package cn.edu.cdu.argorithm.impl;

import cn.edu.cdu.argorithm.IMoveZeros;

public class MoveZeroesSolutions implements IMoveZeros {
    @Override
    public void moveZeroes(int[] nums) {
        int slow = 0, fast = 0, n = nums.length;
        while(fast < n) {
            if(nums[fast] != 0) {
                int temp = nums[slow];
                nums[slow] = nums[fast];
                nums[fast] = temp;
                slow++;
            }
            fast++;
        }
    }
}
